//package com.fwh.web.rabbitmq;
//
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.amqp.rabbit.connection.ConnectionFactory;
//import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener;
//import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.stereotype.Component;
//
///**
// * mq队列监听
// *
// * @author fwh
// * @email fuwenhao594@163.com
// * @date 2019/11/15 下午12:36
// */
//@Component
//@Slf4j
//public class RabbitmqListener {
//
//    @Autowired
//    private ConnectionFactory connectionFactory;
//
//    @Bean
//    public SimpleMessageListenerContainer execMessageContainerOne() {
//        //设置监听者“容器”
//        SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(this.connectionFactory);
//        log.info("通知mq消费方启动监听队列名{}", "fwh");
//        //设置队列名
//        container.setQueueNames("fwh");
//        //监听多个队列名
////        container.setQueueNames("zhihao.debug","zhihao.error","zhihao.info");
//        //设置监听者数量，即消费线程数
//        container.setConcurrentConsumers(1);
//        //设置最大并发数量
//        container.setMaxConcurrentConsumers(5);
//        container.setMessageListener((ChannelAwareMessageListener) (message, channel) -> {
//            if (null != message && null != message.getBody()) {
//                try {
//                    //实际业务处理方法
//                    System.out.println(message);
//                    System.out.println("消费队列名称为："+message.getMessageProperties().getConsumerQueue());
//                    System.out.println("消息内容为："+new String(message.getBody()));
////                    notifyReceiver.notifyProcess(message);
//                } catch (Exception e) {
//                    log.error("通知模块启动监听异常");
//                }
//            }
//        });
//        return container;
//    }
//}
